Skip to content

BUG: Expect a Human Confidence source only from a key that carries it, and accept the level Unknown - #258

Merged
jwrosewell merged 2 commits into
rcfrom
fix/human-confidence-source-test
Nov 22, 2026
Merged

jwrosewell merged 2 commits into
rcfrom
fix/human-confidence-source-test

Conversation

@jwrosewell

@jwrosewell jwrosewell commented Nov 22, 2026 •

Copy link
Copy Markdown
Contributor

Problem

The live test of the Human Confidence web example fails on every configuration of a full build of rc.

Cause

There are two faults in the one test, and the first hid the second.

  1. The source. The example reads the source from humanconfidencesource in the cloud's answer (app.py line 208), and gives None when the answer has none. HumanConfidenceSource is a property of its own. Before it runs, the test checks only that the key carries HumanConfidence (carries_human_confidence, lines 125 to 145). The cloud leaves out a property a key does not carry. The key the tests ran with here carries HumanConfidence and not HumanConfidenceSource, and gives the failure the builds show. The builds' own key can't be read back, so that it lacks the property is taken from the same failure and not seen directly. The example's own offline test, test_passive_without_the_properties_returns_neither, already expects None for that case.
  2. The level. The test expected the level to be High, Medium or Low. The property has a fourth value, Unknown, which the cloud gives when it has too little to rate the request. With the first fault out of the way, the same test failed here with AssertionError: assert 'Unknown' in ('High', 'Medium', 'Low').

What changed

Tests only. The example is unchanged.

  1. tests/helpers.py has a new helper, key_carries(api, resource_key, name), which asks the cloud's accessibleproperties for the properties the key carries and says whether the named one is among them, whatever its case. A status other than 200 raises, with the cloud's text.
  2. test_passive_level_comes_from_the_cloud expects the source to be Passive when the key carries HumanConfidenceSource, and None when it does not.
  3. The levels the test accepts are High, Medium, Low and Unknown.
  4. tests/test_cloud_humanconfidence_web_offline.py has three new tests of the helper, against the stand-in for the cloud that file already has: a property the cloud lists, one it leaves out, and a key the cloud refuses.

How it was verified

Windows, Python 3.12.10, pytest, in pipeline/fiftyone_pipeline_cloudrequestengine/examples, with a resource key that lists 371 properties, HumanConfidence among them and HumanConfidenceSource not.

Commit Result
rc 3abc17e tests/test_cloud_humanconfidence_web.py: 1 failed, assert None == 'Passive', the failure the runners show
First commit, the three helper tests only tests/test_cloud_humanconfidence_web_offline.py does not import: ImportError: cannot import name 'key_carries' from 'helpers'
With the source change alone, before the level change, not a commit AssertionError: assert 'Unknown' in ('High', 'Medium', 'Low')
Second commit, as pushed pytest tests: 111 passed, 1 skipped, 0 failed
  • With no resource key set, the two Human Confidence test files give 35 passed and 3 skipped, so the live tests still skip without a key and the offline tests need none.
  • Not run here: a key that carries HumanConfidenceSource, as none was to hand. That branch is the assertion the test had before. Linux and macOS were not run here either.

What remains

  • No key in the builds shows the source on the example's page. If the builds should check that the source is Passive, a key that carries HumanConfidenceSource has to be given to them. That is a choice about the keys, not about this test.
  • The Human Confidence examples in the other languages may make the same two assumptions. They were not read for this pull request.
  • A second test fails in the same build for a reason this does not touch: test_onpremise_datafileupdate_console asks the Distributor for the Enterprise device detection file, which the data license the builds now use does not include.

…sserts on its value

Three tests of a helper the example tests do not have yet, key_carries,
which reads the cloud's list of the properties a resource key carries.
They fail on import until it exists.
…, and accept the level Unknown

The live test of the Human Confidence web example expected the source
Passive from any key that carries HumanConfidence. HumanConfidenceSource
is a property of its own, and the example gives no source for a key
without it, so the test failed with such a key.

The test now asks the cloud whether the key carries
HumanConfidenceSource, and expects Passive when it does and no source
when it does not.

It also expected the level to be High, Medium or Low. The property has a
fourth value, Unknown, which the cloud gives when it has too little to
rate the request, so the test accepts it.
@jwrosewell
jwrosewell marked this pull request as ready for review November 22, 2026 11:02
@jwrosewell
jwrosewell merged commit 46d4db0 into rc Nov 22, 2026
5 checks passed
@jwrosewell
jwrosewell deleted the fix/human-confidence-source-test branch November 22, 2026 11:02
@jwrosewell jwrosewell mentioned this pull request Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant